﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for B_Level_Genarator
/// </summary>
namespace Bestlife.ERP.BusinessRules
{
    public class B_Level_Genarator:System.Web.UI.Page
    {
        string returnData;
        public B_Level_Genarator()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public string returnlevel(string Dis_ID, string Sup_ID) 
        {
            string Super_ID = Sup_ID;

            Bestlife.ERP.DataAccess.D_Level_Genarator lvl = new DataAccess.D_Level_Genarator();

            string returnString = lvl.Level_Gen(Sup_ID);
            string count= lvl.Child_Count(Sup_ID);

            string[] arr =returnString.Split('/');
            string Parent_To_User = arr[0].ToString();
            string Level = arr[1].ToString();

            int c= int.Parse(count)+1;
            string childlevel = Level + "." + c;
            int PtoU = int.Parse(Parent_To_User) + 1;
            string ParentToUser = PtoU.ToString();

            returnData=ParentToUser+"/"+childlevel;

            return returnData;
        }
    }
}